import MainLayout from "@/components/MainLayout";
import UserDebug from "@/pages/debug/UserDebug";
import DummyPage from "@/pages/DummyPage";
import Login from "@/pages/Login";
import JoyMessageDetails from "@/pages/message/JoyMessageDetails";
import JoyMessageList from "@/pages/message/JoyMessageList";
import OrderDetails from "@/pages/order/OrderDetails";
import OrderList from "@/pages/order/OrderList";
import ProductDetails from "@/pages/product/ProductDetails";
import ProductList from "@/pages/product/ProductList";
import ApplicationList from "@/pages/qualification/ApplicationList";
import Settings from "@/pages/Settings";
import DeliveryVendorMaintainence from "@/pages/system/DeliveryVendorMaintainence";
import DictionaryMaintainence from "@/pages/system/DictionaryMaintainence";
import UserDetails from "@/pages/user/UserDetails";
import UserList from "@/pages/user/UserList";
import { Welcome } from "@/pages/welcome/Welcome";
import { createBrowserRouter } from "react-router-dom";
import AfterSalesDetails from "./pages/afterSales/AfterSalesDetails";
import AfterSalesList from "./pages/afterSales/AfterSalesList";
import ActivityCard from "./pages/product/ActivityCard";
import Carousel from "./pages/product/Carousel";
import StockOperationLogList from "./pages/product/StockOperationLogList";
import ProtocolList from "./pages/protocols/ProtocolList";
import ApplicationDetails from "./pages/qualification/ApplicationDetails";
import ExcelPanel from "./pages/report/ExcelPanel";
import InitAuShops from "./pages/system/InitAuShops";
import ProductCategoryMaintainence from "./pages/system/ProductCategoryMaintainence";
import PrepaidOperationLogList from "./pages/user/PrepaidOperationLogList";
import ManagerGain from "./pages/report/ManagerGain";
import GlobalData from "./pages/report/GlobalData";

const router = createBrowserRouter([
  { path: "/login", element: <Login /> },
  {
    path: "/",
    element: <MainLayout />,
    // errorElement: (
    //   <MainLayout>
    //     <DummyPage title={"404"} />
    //   </MainLayout>
    // ),
    children: [
      {
        path: "/",
        element: <Welcome appName={"良品至信"} />,
      },
      {
        path: "/test/:id",
        element: <DummyPage title={"TEST"} />,
      },
      {
        path: "/carousel",
        element: <Carousel />,
      },
      {
        path: "/activityCard",
        element: <ActivityCard />,
      },
      {
        path: "/products",
        element: <ProductList />,
      },
      {
        path: "/products/:id",
        element: <ProductDetails />,
      },
      {
        path: "/products/:id/stock/operations",
        element: <StockOperationLogList />,
      },
      {
        path: "/stock/operations",
        element: <StockOperationLogList />,
      },

      {
        path: "/prepaid/:id/operations",
        element: <PrepaidOperationLogList />,
      },
      {
        path: "/prepaid/operations",
        element: <PrepaidOperationLogList />,
      },
      {
        path: "/orders",
        element: <OrderList />,
      },
      {
        path: "/orders/:id",
        element: <OrderDetails />,
      },
      {
        path: "/afterSales",
        element: <AfterSalesList />,
      },
      {
        path: "/afterSales/:id",
        element: <AfterSalesDetails />,
      },
      {
        path: "/excel/panel",
        element: <ExcelPanel />,
      },
      {
        path: "/manager/gain",
        element: <ManagerGain />,
      },
      {
        path: "/global/data",
        element: <GlobalData />,
      },
      {
        path: "/AG_SHOP/applications",
        element: <ApplicationList title="开店申请" targetRole="AG_SHOP" />,
      },

      {
        path: "/AG_WHS/applications",
        element: <ApplicationList title="批发商资格申请" targetRole="AG_WHS" />,
      },
      {
        path: "/AG_AGENT/applications",
        element: (
          <ApplicationList title="代理商资格申请" targetRole="AG_AGENT" />
        ),
      },
      {
        path: "/MANAGER/applications",
        element: <ApplicationList title="经理资格申请" targetRole="MANAGER" />,
      },
      {
        path: "/:role/applications/:id",
        element: <ApplicationDetails />,
      },
      {
        path: "/joyMessages/:channel",
        element: <JoyMessageList />,
      },
      {
        path: "/joyMessages/:id/details",
        element: <JoyMessageDetails />,
      },
      {
        path: "/:role/users",
        element: <UserList />,
      },
      {
        path: "/users/:id",
        element: <UserDetails />,
      },
      {
        path: "/settings",
        element: <Settings />,
      },
      {
        path: "/dictionary/maintainence",
        element: <DictionaryMaintainence />,
      },
      {
        path: "/productCategory/maintainence",
        element: <ProductCategoryMaintainence />,
      },

      {
        path: "/deliveryVendor/maintainence",
        element: <DeliveryVendorMaintainence />,
      },
      {
        path: "/initAuShops",
        element: <InitAuShops />,
      },
      {
        path: "/protocols",
        element: <ProtocolList />,
      },
      {
        path: "/debug/users",
        element: <UserDebug />,
      },
    ],
  },
]);

export default router;
